# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iputils
pkgver=20211215
pkgrel=0
pkgdesc="IP Configuration Utilities (and Ping)"
options="!check suid"
url="https://github.com/iputils/iputils/"
arch="all"
license="BSD-3-Clause AND GPL-2.0-or-later AND MIT"
makedepends="libcap-dev meson"
replaces="bbsuid"
source="$pkgname-$pkgver.tar.gz::https://github.com/iputils/iputils/archive/$pkgver.tar.gz"

build() {
	abuild-meson \
		-DNO_SETCAP_OR_SUID=true \
		-DBUILD_NINFOD=false \
		-DBUILD_RARPD=false \
		-DBUILD_RDISC=false \
		-DBUILD_MANS=false \
		-DUSE_IDN=false \
		-DUSE_GETTEXT=false \
		"build"
	ninja -C "build"
}

package() {
	local name
	cd "$builddir"/build

	for name in arping clockdiff tracepath; do
		install -D -m755 $name "$pkgdir"/usr/sbin/${name##*/}
	done

	install -D -m4755 ping/ping "$pkgdir"/bin/ping

	ln -s tracepath "$pkgdir"/usr/sbin/tracepath6
	ln -s ping "$pkgdir"/bin/ping6
}

sha512sums="
191062e51f7c8e8b38e3e4a96845adb77cd69f487d548c7cc578fad544443b4bc0dbe965d8f8e6fbda0a2f5b2fe2829789c05f873190c53d773245959298f6e9  iputils-20211215.tar.gz
"
